export function omit<T extends object, K extends keyof T = keyof T>(
    target: T,
    keys: K[]
  ): Omit<T, K>
export function omit<T extends object, K extends keyof T = keyof T>(
  target: T,
  ...keys: K[]
): Omit<T, K> {
  const result: Record<string | number, any> = {}

  Object.entries(target).forEach(([key, value]) => {
    if (!keys.includes(key as any)) {
      result[key] = value
    }
  })

  return result as any
}

export function tryOnDocumentLoaded(fn: ()=>void) {
  if (document.readyState === 'loading') {
    window.addEventListener('DOMContentLoaded', fn)
  } else {
    fn()
  }
}